package org.chouy.utils.api;


import com.mchange.v2.c3p0.ComboPooledDataSource;

import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.SQLException;

/**
 * @program: Yang
 * @description: JDBC工具类
 * @author: Zhouy
 * @create: 2019-02-19 10:20
 **/
public class JDBCUtils {

    /**
     * 获取c3p0连接池对象
     */
    private static ComboPooledDataSource ds = new ComboPooledDataSource();


    //获取数据库连接对象
    public static Connection getConnection() throws SQLException {
        return ds.getConnection();
    }

    //获取c3p0连接池对象
    public static DataSource getDataSource(){
        return ds;
    }
}
